home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 426-450 / disk_438 / toollib / tool.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  7KB  |  239 lines

  1. /*
  2.  *   tool.h version 7.6 - © Copyright 1990 Jaba Development
  3.  *
  4.  *   Author : Jan van den Baard
  5.  *
  6.  *   Aztec C v5.0a header
  7.  */
  8.  
  9. #ifndef TOOL_H
  10. #define TOOL_H
  11.  
  12. #ifndef EXEC_TYPES_H
  13. #include <exec/types.h>
  14. #endif
  15. #ifndef EXEC_MEMORY_H
  16. #include <exec/memory.h>
  17. #endif
  18. #ifndef EXEC_PORTS_H
  19. #include <exec/ports.h>
  20. #endif
  21. #ifndef EXEC_IO_H
  22. #include <exec/io.h>
  23. #endif
  24. #ifndef DEVICES_TIMER_H
  25. #include <devices/timer.h>
  26. #endif
  27. #ifndef EXEC_LIBRARIES_H
  28. #include <exec/libraries.h>
  29. #endif
  30. #ifndef LIBRARIES_DOS_H
  31. #include <libraries/dos.h>
  32. #endif
  33. #ifndef LIBRARIES_DOSEXTENS_H
  34. #include <libraries/dosextens.h>
  35. #endif
  36. #ifndef INTUITION_INTUITION_H
  37. #include <intuition/intuition.h>
  38. #endif
  39. #ifndef INTUITION_INTUITIONBASE_H
  40. #include <intuition/intuitionbase.h>
  41. #endif
  42.  
  43. struct ToolBase
  44.  {
  45.   struct Library        LibNode;
  46.   struct ExecBae       *SysBase;
  47.   struct DosLibrary    *DOSBase;
  48.   struct IntuitionBase *IntuitionBase;
  49.   struct GfxBase       *GfxBase;
  50.   LONG                  SegList;
  51.  };
  52.  
  53. #define TOOL_VERSION    7
  54. #define TOOL_REVISION   6
  55.  
  56. struct TimeDelay
  57.  {
  58.   struct MsgPort     *td_UserPort;
  59.   struct MsgPort     *td_ReplyPort;
  60.   struct timerequest *td_TimeRequest;
  61.  };
  62.  
  63. #define LONGALLIGN(s)   (((s)+7)&-8)
  64.  
  65. /*
  66.  *   The MemoryBlock, MemoryItem, BlockList and ItemList structures
  67.  *   are PRIVATE structures used by the memory routines of the library.
  68.  *   DO NOT SCREW ARROUND WITH THESE STRUCTURES BECAUSE THEY MIGHT CHANGE
  69.  *   IN FUTURE RELEASES OF THE LIBRARY !!!!!!!!!
  70.  */
  71. struct MemoryBlock
  72. {
  73.  struct MemoryBlock *mb_Next;
  74.  struct MemoryBlock *mb_Previous;
  75.  ULONG               mb_Requirements;
  76.  ULONG               mb_BytesUsed;
  77. };
  78.  
  79. struct MemoryItem
  80. {
  81.  struct MemoryItem  *mi_Next;
  82.  struct MemoryItem  *mi_Previous;
  83.  struct MemoryBlock *mi_Block;
  84.  ULONG               mi_Size;
  85. };
  86.  
  87. struct BlockList
  88. {
  89.  struct MemoryBlock *bl_First;
  90.  struct MemoryBlock *bl_End;
  91.  struct MemoryBlock *bl_Last;
  92. };
  93.  
  94. struct ItemList
  95. {
  96.  struct MemoryItem *il_First;
  97.  struct MemoryItem *il_End;
  98.  struct MemoryItem *il_Last;
  99. };
  100.  
  101. /*
  102.  * YOU MAY ONLY USE THIS STRUCTURE TO PASS TO THE MEMORY ROUTINES OF
  103.  * THE LIBRARY. DO NOT CHANGE THE CONTENTS OF A MEMORYCHAIN STRUCTURE
  104.  * IN YOUR PROGRAMS BECAUSE THIS STRUCTURE MAY CHANGE IN FUTURE RELEASES
  105.  * OF THE LIBRARY !!!!!!!!!
  106.  */
  107. struct MemoryChain
  108. {
  109.  struct BlockList   mc_Blocks;
  110.  struct ItemList    mc_Items;
  111.  ULONG              mc_BlockSize;
  112. };
  113.  
  114. #define MINDATE     32
  115. #define ALL         0
  116. #define ONLY_DAY    1
  117. #define ONLY_DATE   2
  118. #define ONLY_TIME   3
  119.  
  120. #define NO_CASE     0
  121. #define CASE        1
  122.  
  123. #define ENTRY_FILE      0
  124. #define ENTRY_DIR       1
  125. #define ENTRY_DEV       2
  126.  
  127. #define DIRBLOCK        (5 * 1024)
  128.  
  129. struct EntryInfo
  130. {
  131.     struct EntryInfo    *ei_Next;
  132.     struct EntryInfo    *ei_Previous;
  133.     USHORT               ei_Type;
  134.     UBYTE                ei_Name[32];
  135.     LONG                 ei_SizeBytes;
  136.     LONG                 ei_SizeBlocks;
  137.     LONG                 ei_ProtectionBits;
  138.     struct DateStamp     ei_Date;
  139. };
  140.  
  141. struct Directory
  142. {
  143.     struct EntryInfo     *dr_First;
  144.     struct EntryInfo     *dr_End;
  145.     struct EntryInfo     *dr_Last;
  146.     struct FileInfoBlock *dr_InfoBlock;
  147.     BPTR                 dr_Lock;
  148.     ULONG                dr_NumEntries;
  149.     struct MemoryChain   dr_DirMem;
  150. };
  151.  
  152. #define FREQ_OK             0
  153. #define FREQ_CANT_OPEN      1
  154. #define FREQ_FILE_ERROR     2
  155. #define FREQ_CANCELED       3
  156.  
  157. struct FileRequester
  158. {
  159.  char             *fr_HeadLine;
  160.  char             *fr_FileName;
  161.  char             *fr_DirName;
  162.  char             *fr_DontShow;
  163.  USHORT            fr_LeftEdge;
  164.  USHORT            fr_TopEdge;
  165.  struct Window    *fr_Caller;
  166.  struct Screen    *fr_Screen;
  167.  struct Directory *fr_Directory;
  168.  USHORT            fr_Flags;
  169.  USHORT            fr_Colors[4];
  170.  BPTR              fr_Handle;
  171.  LONG              fr_Reserved;
  172. };
  173.  
  174. #define FREQ_WIDTH      260
  175. #define FREQ_HEIGHT     140
  176.  
  177. #define FR_NoPreserve      1
  178. #define FR_NoDevs          2
  179. #define FR_NoSort          4
  180. #define FR_CustColor       8
  181. #define FR_ReturnOld       16
  182. #define FR_ReturnNew       32
  183. #define FR_ReturnReadWrite 64
  184. #define FR_ReturnVoid      0
  185.  
  186. #ifndef __FUNCTIONS_H
  187. struct MsgPort *CreatePort(char *name, long pri);
  188. void DeletePort(struct MsgPort *port);
  189. struct IORequest *CreateExtIO(struct MsgPort *port, long size);
  190. void DeleteExtIO(struct IORequest *req);
  191. struct IOStdReq *CreateStdIO(struct MsgPort *port);
  192. void DeleteStdIO(struct IOStdReq *req);
  193. #endif
  194. struct TimeDelay *CreateTimeDelay(struct MsgPort *port, long se, long mi);
  195. long DoTimeDelay(struct TimeDelay *dt);
  196. void DeleteTimeDelay(struct TimeDelay *dl);
  197. void QuickSort(char *base, long num, long size, long (*compa)());
  198. void SwapMem(char *mema, char *memb, long size);
  199. long TestBits(long value, long bits);
  200. void SelectGadget(struct Window *w, struct Gadget *g, struct Requester *r);
  201. void DeSelectGadget(struct Window *w, struct Gadget *g, struct Requester *r);
  202. void MutualExclude(struct Window *w, struct Gadget *g, struct Gadget *f, struct Requester *r);
  203. void MutualInclude(struct Window *w, struct Gadget *g, struct Gadget *f, struct Requester *r);
  204. void EraseGadget(struct Window *w, struct Gadget *g, struct Requester *r);
  205. void GadgetOn(struct Window *w, struct Gadget *g, struct Requester *r);
  206. void GadgetOff(struct Window *w, struct Gadget *g, struct Requester *r);
  207. long SelectTest(struct Gadget *g);
  208. void ShadowGadget(struct Window *w, struct Gadget *g, struct Requester *r, long col);
  209. void OnGList(struct Window *w, struct Gadget *g, struct Requester *r, long n);
  210. void OffGList(struct Window *w, struct Gadget *g, struct Requester *r, long n);
  211. void SelectGList(struct Window *w, struct Gadget *g, struct Requester *r, long n);
  212. void DeSelectGList(struct Window *w, struct Gadget *g, struct Requester *r, long n);
  213. void ShadowGList(struct Window *w, struct Gadget *g, struct Requester *r, long n, long c);
  214. void EraseGList(struct Window *w, struct Gadget *g, struct Requester *r, long n);
  215. void InitMemoryChain(struct MemoryChain *mchain, long size);
  216. void *AllocItem(struct MemoryChain *mchain, long size, long reqs);
  217. void FreeItem(struct MemoryChain *mchain, void *memptr, long size);
  218. void FreeMemoryChain(struct MemoryChain *mchain);
  219. void Format(char *buffer, char *fstring, ...);
  220. long WriteFormat(BPTR file, char *fstring, ...);
  221. long MatchPattern(char *string, char *pattern, long cse);
  222. long Isolate(char *pathname, char *buffer);
  223. void BstrToCstr(BPTR *bstr, char *buffer);
  224. long GetDate(struct DateStamp *date, char *buffer, long how);
  225. long OpenDir(struct Directory *dir, char *name);
  226. struct EntryInfo *GetEntry(struct Directory *dir);
  227. void CloseDir(struct Directory *dir);
  228. void FreeDir(struct Directory *dir);
  229. char *IoErrToStr();
  230. struct FileRequester *AllocFreq();
  231. void FreeFreq(struct FileRequester *freq);
  232. long FileRequest(struct FileRequester *freq);
  233.  
  234. #ifndef __NO_PRAGMAS
  235. #include <tool_pragmas.h>
  236. #endif
  237.  
  238. #endif
  239.